# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-re2
pkgname=('python2-re2' 'python-re2')
_pkgname=re2
pkgver=0.2.24
pkgrel=7
pkgdesc="Python wrapper for Google's RE2 using Cython."
arch=('x86_64' 'aarch64')
url='https://pypi.org/project/re2/#files'
license=('BSD')
makedepends=('python2-setuptools' 'python-setuptools' 're2')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('b056cfbf4d227afb3fc83fa8ecbc16311a009d5c7132fcdf1eba827d76c1c3ef90545dbfa97cabec22a50b85720f7af9284e9317302adc130e1205ff1b78f0ea')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-re2() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-re2() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

